
<h1><?php echo __('Jobs List') ?></h1>

<?php include_partial('global/searchForm', array('actionUrl'  => url_for('job/index'), 'formFilter' => $formFilter)) ?>
<?php if ($maxUser->getMaxUserRole()->canAdd()): ?>
    <a class="addNewItem right button noClear" href="<?php echo url_for('job/new') ?>'"><?php echo __('New') ?></a>
<?php endif; ?>
<table class="table adminGrid">
    <thead>
        <tr>
            <th><?php echo __('Category') ?></th>
            <th><?php echo __('Company') ?></th>
            <th><?php echo __('User') ?></th>
            <th><?php echo __('Title') ?></th>
            <th><?php echo __('Visits') ?></th>
            <th><?php echo __('Need check') ?></th>
            <th><?php echo __('Statues') ?></th>
            <th><?php echo __('Created at') ?></th>
            <th><?php echo __('Edit') ?></th>
            <th><?php echo __('Delete') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($pager->getResults() as $job): ?>
            <tr>
                <td><?php echo $job->getCategory() ?></td>
                <td><?php echo $job->getCompany() ?></td>
                <td><?php echo $job->getUser() ?></td>
                <td><?php echo $job->getTitle() ?></td>
                <td><?php echo $job->getVisits() ?></td>
                <td><?php echo $job->getNeedCheck() ?></td>
                <td><?php echo $job->getStatues() ?></td>
                <td><?php echo $job->getCreatedAt() ?></td>
                <?php if ($maxUser->getMaxUserRole()->canEdit()): ?>
                    <td><a href="<?php echo url_for('job/edit?id=' . $job->getId()) ?>"><?php echo __('edit') ?></a></td>
                <?php else: ?>
                    <td>edit</td>
                <?php endif; ?>
                <?php if ($maxUser->getMaxUserRole()->canDelete()): ?>
                    <td><?php echo link_to(__('Delete'), 'job/delete?id=' . $job->getId(), array('method'  => 'delete', 'confirm' => __('Are you sure?'))) ?></td>
                <?php endif; ?>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php include_partial('global/pager', array('pager'     => $pager, 'routeName' => 'job')) ?>
